/*
 * @Author: wangjianwhy wangjianwhy@sina.com
 * @Date: 2024-10-17 16:35:31
 * @LastEditors: wangjianwhy wangjianwhy@sina.com
 * @LastEditTime: 2024-10-31 18:09:17
 * @FilePath: \my-vue3-appg:\vscode-work\tlo-shopping\src\components\util\Tools.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export function truncateText (text, maxLength) {
    return text.length > maxLength ? text.slice(0, maxLength) + ' . . .' : text;
}

export function pointBefore(price) {
    return Math.floor(price);
}

export function pointAfter(price) {
    // 将数字转换为字符串
    const numberStr = price.toFixed(2).toString();
    // 找到小数点的位置
    const decimalIndex = numberStr.indexOf('.');
    return numberStr.substr(decimalIndex + 1);
}
